<template>
  <div id="app">
    <h1>axios</h1>
    <div>
      <h3>学生信息</h3>
      <span class="tip">姓名</span> <span>{{name}}</span>  <br>
      <span class="tip">班级</span> <span>{{calssName}}</span> <br>
      <span class="tip">年龄</span> <span>{{age}}</span> 
    </div>

  </div>
</template>

<script>
export default {
  name: "App",
  data: function() {
    return {
      calssName: '',
      name: '',
      age: 0
    };
  },
  mounted: function () {
    this.$axios.get('data.json')
        .then(res => {
          console.log(res)
          this.calssName = res.class
          this.name = res.name
          this.age = res.age
        })
        .catch(err => {
          console.log(err)
        })
  }
  
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
.tip {
  color: red;
}
</style>
